package yang.yu.sunny.infra.persistence;

/**
 * Created by yyang on 16/3/30.
 */
public class DataSourceHolder {

    private static final ThreadLocal<DataSources> dataSourceTypes = new InheritableThreadLocal<DataSources>(){
        @Override
        protected DataSources initialValue(){
            return DataSources.PRODUCT;
        }
    };

    public static DataSources get(){
        return dataSourceTypes.get();
    }

    public static void set(DataSources dataSourceType){
        dataSourceTypes.set(dataSourceType);
    }

    public static void reset(){
        dataSourceTypes.set(DataSources.PRODUCT);
    }
}
